import request from '@/utils/request'
import type { Achievement, ApiResponse } from '@/types'

export const achievementApi = {
  // 获取所有成就
  getAllAchievements(): Promise<ApiResponse<{ all: Achievement[]; byCategory: any }>> {
    return request.get('/achievement')
  },
  
  // 获取用户已解锁的成就
  getUserAchievements(): Promise<ApiResponse<Achievement[]>> {
    return request.get('/achievement/user')
  },
  
  // 检查并解锁成就
  checkAndUnlockAchievements(): Promise<ApiResponse> {
    return request.post('/achievement/check')
  },
  
  // 获取成就进度
  getAchievementProgress(): Promise<ApiResponse> {
    return request.get('/achievement/progress')
  }
}

